<template>
	<view>
		<zx-head Title="知心" :isShowR="true"></zx-head>
		<view class="list">
			<view class="item" v-for="(dom,index) in pageList" :key="index" @click="toList(dom)">
				<view class="title">
					{{dom.experimentName}}
				</view>
				<view class="info">
					<view class="num fr">
						<image src="@/static/img/index/zxIcon3.png" mode=""></image>
						{{dom.semSingleExperimentSize}}个实验
					</view>
					<view class="subTitle" style="overflow: hidden;">
						{{dom.experimentBeforeTextPrompt}}
					</view>
					
				</view>
			</view>
			<l-loadmore ref="more" :pageindex="page.pageParam.pageNum"></l-loadmore>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
				page: {
					pageParam: {
						pageNum: 1,
						pageSize: 10,
					}
				},
				pageList: [],
				totalPage: 1,
				
			
			};
		},
		onLoad() {
			
		},
		onShow() {
			this.getPageList()
		},
		methods: {
			clickBack(e) {

			},
			toList(dom) {
				uni.navigateTo({
					url: '/pages/comA/zhixin/list?id=' + dom.id + "&content=" + dom.experimentBeforeTextPrompt
					+ "&size=" + dom.semSingleExperimentSize+ "&title=" + dom.experimentName
				})
			},
			getPageList() {
				let thisData = this;
				let data = {"url": "/admin/app/semSingleGroup/list" , "data": thisData.page}
				uni.$_post({
					url: "getRequestResult",
					that: thisData,
					params: data,
					success(res) {
						let _data = res.data.data.dataList;
						if (res.data.success) {
							//分页
							if (_data.length == 0) {
								thisData.totalPage = 0;
							}
							if (thisData.page.pageParam.pageNum > 1) {
								thisData.pageList = thisData.pageList.concat(_data);
							} else {
								thisData.pageList = _data;
							}
							thisData.$refs.more.status = "loadmore";
						} else{
							uni.showToast({
								title: res.msg,
								duration: 1500,
								icon:'error'
							});
						}
					},
					fail(err) {
						uni.showToast({
							title: err.msg,
							duration: 1000,
							icon: 'error'
						});
					},
				});
			},
		
		},
		//上拉加载更多
		onReachBottom() {
			let that = this
			that.$refs.more.status = "loadmore";
			if (that.totalPage == 0) {
				that.$refs.more.status = "nomore";
				return;
			}
			that.page.pageParam.pageNum++;
			setTimeout(()=>{
				that.$refs.more.status = "loading";
				that.getPageList();
			},1000)
			
		},
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5f5f5;
	}

	.list {
		padding: 30rpx;

		.item {
			// height: 160rpx;
			background: #ffffff;
			border-radius: 20rpx;
			box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.05);
			margin-bottom: 30rpx;
			padding: 35rpx 30rpx 30rpx;
			box-sizing: border-box;

			.title {
				font-size: 36rpx;
				color: #000000;
				font-family: $uni-font-family-Bold;
				margin-bottom: 10rpx;
			}

			.info {
				.subTitle {
					font-size: 24rpx;
					color: #A4A9B7;

				}

				.num {

					font-size: 22rpx;
					color: #677085;
					margin-left: 30rpx;

					image {
						width: 18rpx;
						height: 20rpx;
						margin-right: 12rpx;
					}
				}
			}
		}
	}
</style>